package com.zzy.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzy.system.domain.DetectReportPictures;
import com.zzy.system.domain.DetectReportSpus;
import com.zzy.system.mapper.DetectReportSpusMapper;
import com.zzy.system.service.IDetectReportSpusService;
import com.zzy.system.service.IGuanmaiSpuService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DetectReportSpusServiceImpl extends ServiceImpl<DetectReportSpusMapper, DetectReportSpus> implements IDetectReportSpusService {

    private static final Logger log = LoggerFactory.getLogger(DetectReportSpusServiceImpl.class);

    public void saveReportSpusList(List<DetectReportSpus> detectReportSpuses) {
        if(detectReportSpuses != null && !detectReportSpuses.isEmpty()){
            QueryWrapper<DetectReportSpus> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("report_id", detectReportSpuses.get(0).getReportId());
            this.baseMapper.delete(queryWrapper);
            this.saveBatch(detectReportSpuses);
        }

    }
}